home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / dial / amitcp_session.lha / AmiTCP_session-1.0 / c / nntpcopy.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1994-08-06  |  1.1 KB  |  47 lines

  1. /*
  2.  * nntpcopy version 1.0
  3.  *
  4.  * ARexx script to copy a news article into uunews:NNTPSpoolDir
  5.  * A unique filename is created before copying the article 
  6.  * Usage: nntpcopy <article>
  7.  *
  8.  * Written by David Jameson, 1994.
  9.  */
  10.  
  11. arg args
  12.  
  13. /* Open RexxSupport library */
  14.  
  15. if ~show('L', 'rexxsupport.library') then do
  16.     if addlib('rexxsupport.library', 0, -30, 0) then
  17.         say 'added rexxsupport.library'
  18.     else do
  19.         say 'failed to open rexxsupport.library'
  20.         exit 10
  21.     end
  22. end
  23.  
  24. date = date()
  25. parse var date day month year
  26.  
  27. /* Remove leading spaces from year */
  28. year = right(year,4)
  29.  
  30. time = time()
  31. parse var time hour ':' min ':' sec
  32. filename = 'article.'||hour||'.'||min||'.'||sec||'.'||day||month||year
  33.  
  34. if exists('uunews:NNTPSpoolDir/'||filename) then do
  35.     say 'Error: temporary file already exists'
  36.     exit 20
  37. end
  38.  
  39. /* Copy file into NNTPSpoolDir */
  40.  
  41. address command
  42. 'copy' args 'uunews:NNTPSpoolDir/'||filename||' >t:'||filename
  43. ret_val = statef('t:'||filename)    /* major kludge... */
  44. parse var ret_val type size ignore
  45. if size ~= 0 then exit 10    /* copy failed */
  46. exit 0
  47.